import { ref } from "vue";
import type { AvueFormOption } from "@smallwei/avue";

export default function (props: any) {
  const option: AvueFormOption = {
    menuBtn: false,
    labelWidth: 110,
    column: [
      {
        prop: "name",
        label: +props.petType === 1 ? "猫猫名字" : "狗狗名字",
        search: true,
        rules: [
          {
            required: true,
            message: "请输入猫名字",
          },
        ],
      },
      {
        prop: "saleUnit",
        label: "售出",
        labelTip: "售出公司或宠物店",
      },
      {
        prop: "chipCode",
        label: "芯片编号",
      },
      {
        prop: "variety",
        label: "品种",
      },
      {
        prop: "color",
        label: "花色",
      },
      {
        type: "select",
        prop: "sex",
        label: "性别",
        dicUrl: "/api/system/dict/type/optionSelect/pet_sex",
        value: "1",
        props: {
          label: "dictLabel",
          value: "dictValue",
        },
      },
      {
        type: "date",
        prop: "brithday",
        label: "出生日期",
        valueFormat: "YYYY-MM-DD HH:mm:ss",
      },
      {
        type: "select",
        prop: "hair",
        label: "长短毛",
        dicUrl: "/api/system/dict/type/optionSelect/pet_hair",
        value: "1",
        props: {
          label: "dictLabel",
          value: "dictValue",
        },
      },
      {
        prop: "host",
        label: "主人名字",
      },
      {
        prop: "catteryId",
        label: +props.petType === 1 ? "猫舍" : "狗舍",
        type: "select",
        dicUrl: "/api/cattery/list",
        props: {
          label: "name",
          value: "id",
        },
      },
      {
        prop: "shelfNum",
        label: "货架号数",
      },
      {
        prop: "parent",
        label: "父母",
      },
      {
        prop: "grade",
        label: "等级",
      },
      {
        prop: "generation",
        label: "第几代",
      },
      {
        type: "select",
        prop: "petStatus",
        label: "宠物状态",
        dicUrl: "/api/system/dict/type/optionSelect/pet_status",
        value: "1",
        props: {
          label: "dictLabel",
          value: "dictValue",
        },
      },
      {
        prop: "brand",
        label: "品牌",
      },
      {
        type: "upload",
        prop: "imgUrl",
        label: "图片",
        listType: "picture-card",
        action: "/api/upload",
        dataType: "string",
        span: 24,
      },
    ],
  };
  return ref(option);
}
